package model.mediators;

import java.awt.Container;
import java.awt.GridLayout;
import java.util.Iterator;
import java.util.LinkedList;

import javax.swing.JFrame;
import javax.swing.JPanel;

import model.entity.Entity;

public class WindowedItemExchange extends JFrame {

    private String name;
    private Entity patron;
    private Entity shopkeeper;

    public WindowedItemExchange(Entity active, Entity passive, String name) {
        super(name);
        patron = active;
        shopkeeper = passive;
        this.name = name;
    }

    public void createWindow() {
        Container pane = super.getContentPane();
        this.setLayout(new GridLayout(0, 2, 10, 10));


        super.setVisible(true);
    }

    private class TradeWindow extends JPanel {

        private LinkedList<InteractionOption> list;
        private String title;

        TradeWindow(String name) {
            list = new LinkedList<InteractionOption>();
            title = name;
        }

        public void add(InteractionOption opt) {
            list.add(opt);
        }

        public void remove(InteractionOption opt) {
            list.remove();
            refresh();
        }

        private void refresh() {
            super.removeAll();
            super.setLayout(new GridLayout(list.size(), 0, 10, 10));

        }
    }
}
